<template>
  <div class="viewcontainer" v-if="dataset">
    <hi-toolbar :source="dataset" v-bind="toolbar"></hi-toolbar>

    <hi-form
      ref="detailForm"
      :model="dataset.curRecord"
      :dataSource="dataset"
      v-bind="form"
    ></hi-form>
    <p class="viewcontainer_title">
      根据GSP规定，商品在进行温湿度控制时：<br />
      常温区控制在10℃-30℃之间 <br />
      冷藏区为2℃-10℃之间 <br />
      阴凉区≤20℃之间<br />
      湿度控制在35%-75%之间　
    </p>
  </div>
</template>

<script>
import { HiForm, DataSetContainer, HiToolbar } from "hi-ui";
import viewBase from "../../base";
import datasetCfg from "./dataset";
export default {
  name: "humitureDetail",
  extends: viewBase,
  components: {
    HiForm,
    HiToolbar,
  },

  data() {
    let dataset = null;
    return {
      //数据集配置
      datasetCfg: datasetCfg,
      //数据集
      dataset: dataset,
      toolbar: {
        buttons: [
          {
            kind: "save",
            //text: "保存",
            type: "danger",
            icon: "el-icon-upload",
          },
        ],
      },

      //数据桥梁
      dataBridge: new Map(),
      //编辑数据
      editData: {},
      //表单配置
      form: {
        columnsTotal: 2,
        labelWidth: "180px",
        items: [
          {
            name: "FRECORDPERSON",
          },

          {
            name: "FTIME",
            element: "hi-select-grid",
            props: {
              selectOption: {
                // remote:true,
                loading: true,
                multiple: false,
                clearable: true,
                filterable: true,
                "allow-create": true,
                "collapse-tags": true,
              },
              lookup: {
                modelFile: "database/base/dataset/BaseEntity.xml",
                param: {
                  FPID: "shiduan",
                },
                tableprops: {
                  // border:true,
                  //stripe:true,
                  "show-header": false,
                  //fit:false,
                  size: "mini",
                  "max-height": 400,
                },
                returnFields: {
                  FTIME: "FDESC",
                },
                columns: [
                  {
                    name: "FDESC",
                    label: "单位",
                  },
                ],
              },
            },
          },
          {
            name: "FMONITOR",
            element: "hi-select-grid",
            props: {
              selectOption: {
                // remote:true,
                loading: true,
                multiple: false,
                clearable: true,
                filterable: true,
                "allow-create": true,
                "collapse-tags": true,
              },
              lookup: {
                modelFile: "database/base/dataset/BaseEntity.xml",
                param: {
                  FPID: "jkqy",
                },
                tableprops: {
                  // border:true,
                  //stripe:true,
                  "show-header": false,
                  //fit:false,
                  size: "mini",
                  "max-height": 400,
                },
                returnFields: {
                  FMONITOR: "FDESC",
                },
                columns: [
                  {
                    name: "FDESC",
                    label: "单位",
                  },
                ],
              },
            },
          },
          {
            name: "FEQUIPMENTDESC",
          },
          {
            name: "FEQUIPMENTID",
          },
          {
            name: "FTEMPERATURE",
          },
          {
            name: "FHUMIDITY",
          },
          {
            name: "FADJUST",
            element: "hi-select-grid",
            props: {
              selectOption: {
                // remote:true,
                loading: true,
                multiple: true,
                clearable: true,
                filterable: true,
                "allow-create": true,
                "collapse-tags": true,
              },
              lookup: {
                modelFile: "database/base/dataset/BaseEntity.xml",
                param: {
                  FPID: "tkcs",
                },
                tableprops: {
                  // border:true,
                  //stripe:true,
                  "show-header": false,
                  //fit:false,
                  size: "mini",
                  "max-height": 400,
                },
                returnFields: {
                  FADJUST: "FDESC",
                },
                columns: [
                  {
                    name: "FDESC",
                    label: "单位",
                  },
                ],
              },
            },
          },
          {
            name: "FADJUSTTEMPERATURE",
          },
          {
            name: "FADJUSTHUMIDITY",
          },
          {
            name: "FCREATEDATE",
          },
        ],
      },
    };
  },
  model: {
    prop: "value",
    event: "valuechange",
  },
  props: {
    value: {
      type: Object,
    },
  },

  computed: {},
  watch: {},
  methods: {},
  mounted() {
    this.dataset = this.$dsContainer.createDataSet(this.datasetCfg);
    this.dataset.on("aftersave", (res, store) => {
      if (res.status == 200) {
        this.closepage();
      }
    });
    this.dataBridge.set(this.dataset, ["detailForm"]);
    if (this.$route.query.id) {
      this.dataset.load({
        FID: this.$route.query.id,
      });
    } else {
      this.dataset.add({});
    }
  },
};
</script>

<style rel="stylesheet/scss" lang="scss" scope>
.viewcontainer_title {
  font-size: 10px;
  line-height: 20px;
  padding: 30px 0 0 80px;
}
</style>
